//
//  Utility.h
//  Moo-O Touch
//
//  Created by Reisen on 11/17/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>

@interface Utility : NSObject
{
}

//+(UIImage*) UIImageFromIplImage:(IplImage*) iplImage;
+(UIImage *) UIimageFromSampleBuffer:(CVImageBufferRef) imageBuffer;
+(UIImage *) UIimageFromSampleBuffer:(CVImageBufferRef) imageBuffer withOrientation:(UIImageOrientation) orientation;
+(CGImageRef) rotateCGImage:(CGImageRef) image toOrientation:(UIImageOrientation)orientation;
+(CVPixelBufferRef) pixelBufferFromCGImage: (CGImageRef) image;

+(void) startTiming;
+(NSTimeInterval) endTimingWithTag:(NSString*)tag;

+ (UIImage *)reflectedImage:(UIImageView *)fromImage withHeight:(NSUInteger)height;

+ (UIImage *)borderImage:(UIImageView *)fromImage;
+ (UIImage *)borderImage:(UIImageView *)fromImage withStroke:(CGFloat)stroke;
+ (UIImage *)borderImageWithRect:(CGRect)bound withStroke:(CGFloat)stroke;

+ (NSURL*)applicationDataDirectory;

+(void) reportMemoryUsage;
+(void) startMemory;
+(void) endMemoryWithTag:(NSString*)tag;

+(UIImage*)imageNamed:(NSString*)name;
+(UIImage*)resizedImage: (UIImage*)source size:(CGSize)newSize;
+(UIImage*)imageNamed: (NSString*)name size:(CGSize)newSize;

+(NSString*) md5Hash:(NSString*)string;

+(NSString*) rootStorage;
+(NSString*) APIRoot;
//+(NSUInteger)fitString:(NSString *)string intoLabel:(UILabel *)label;

+(NSData*) postRequest:(NSString*) url :(NSMutableDictionary*) data;
+(NSData*) postRequestWithString:(NSString*) url :(NSString*)parameters;


+ (NSString *)hexStringFromColor:(UIColor *)color;
+(NSString*)NSStringFromUIColor:(UIColor*) color;
+(UIColor*)UIColorFromNSString:(NSString*)string;

+(NSString*)XMLEncodedString:(NSString*)s;

+(CGRect)frameFromFrame:(CGRect)frame beforeTransform:(CGAffineTransform)trans;

+(void)setAudioCategory:(NSString*)category;
@end